package com.lintf.web.controller.bot;

import com.lintf.bot.domain.dto.BotGroupAddDTO;
import com.lintf.bot.domain.dto.BotGroupListDTO;
import com.lintf.bot.domain.dto.BotGroupRemoveDTO;
import com.lintf.bot.domain.dto.BotGroupUpdateDTO;
import com.lintf.bot.service.IBotGroupService;
import com.lintf.common.core.controller.BaseController;
import com.lintf.common.core.domain.AjaxResult;
import com.lintf.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author lin tingfeng
 * @system Mac
 * @data 2024/3/14 09:53
 * @package_name com.lintf.web.controller.bot
 * @project_name mobile-project
 * @desc
 */
@RequestMapping("/bot/group")
@RestController
public class BotGroupController extends BaseController {

    @Autowired
    private IBotGroupService botGroupService;

    @GetMapping("/list")
    public TableDataInfo list(BotGroupListDTO dto) {
        return getDataTable(botGroupService.list(dto));
    }

    @GetMapping("/searchOfList")
    public TableDataInfo searchOfList(BotGroupListDTO dto) {
        return getDataTable(botGroupService.searchOfList(dto));
    }

    @PostMapping("/add")
    public AjaxResult add(@RequestBody BotGroupAddDTO dto) {
        botGroupService.add(dto);
        return AjaxResult.success();
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody BotGroupUpdateDTO dto) {
        botGroupService.update(dto);
        return AjaxResult.success();
    }

    @PostMapping("/remove")
    public AjaxResult remove(@RequestBody BotGroupRemoveDTO dto) {
        botGroupService.remove(dto);
        return AjaxResult.success();
    }

}
